<%@page import="com.wanmait.cookbook.vo.Pager"%>
<%@page import="com.wanmait.cookbook.vo.WorksReport"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%String path= request.getContextPath(); %>
<table class="result-tab" width="100%">
					<tr>
						<th class="tc" width="5%"><input class="allChoose" name=""
							type="checkbox"></th>
						<th>序号</th>
						<th>举报人</th>
						<th>作品名称</th>
						<th>作品简介</th>
						<th>作品图片</th>
						<th>被举报人</th>
						<th>被举理由</th>
						<th>举报时间</th>
						<th>操作</th>
					</tr>
					<%
							
					List<WorksReport> reports =(List<WorksReport>)request.getAttribute("reports");
                        	for(int i=0;i<reports.size();i++) {	
                        %>
					<tr id="tr<%=reports.get(i).getId()%>">
						<td class="tc"><input data-id="<%=reports.get(i).getId()%>" class="choose" name="id[]"
							type="checkbox"></td>
						<td><%=i+1 %></td>
						<td><%=reports.get(i).getUserinfo().getUsername() %></td>
						<td><%=reports.get(i).getWorks().getTitle()  %></td>
						<td><%=reports.get(i).getWorks().getInfo()%></td>
						<td><img width="50" height="50" src="<%=path %>/static/image/<%=reports.get(i).getWorks().getPic()%>"></td>
						<td><%=reports.get(i).getWorks().getUserinfo().getUsername()  %></td>
						<%if(reports.get(i).getReason()==1){  %>
							<td>暴力</td>
						<% }else if(reports.get(i).getReason()==2){%>
							<td>色情</td>
						<% }else if(reports.get(i).getReason()==3){%>
							<td>广告</td>
						<% }else if(reports.get(i).getReason()==4){%>
							<td>诈骗</td>
						<% }else{%>
							<td>其他</td>
						<% }%>
						<td><%=reports.get(i).getInputTime()  %></td>
						<td>
						<a class="pass" href="javascript:void(0)" data-id="<%=reports.get(i).getId() %>" data-commentid="<%=reports.get(i).getWorks().getId()%>" data-userid="<%=reports.get(i).getWorks().getUserinfo().getId()%>">通过</a>
						<a class="link-del"
							id="del<%=reports.get(i).getId() %>"
							href="javascript:void(0)">驳回</a></td>
					</tr>
					<%
                        	}
                        %>
				</table>
					<div class="list-page">
					<a id="prev" href="javascript:void(0);">上一页</a>
							<!-- 显示数字 -->
							<%Pager pager = (Pager)request.getAttribute("pager"); %>
							<%
							int start = 1;
							int end = pager.getPageCount();
							if(pager.getPageCount()>5)
							{
								start = pager.getPageNo()-2<1?1:pager.getPageNo()-2;
								end = start+4;
								if(end>pager.getPageCount())
								{
									end = pager.getPageCount();
									start = end-4;
								}
							}
							for (int i = start; i <= end; i++) {
								if(pager.getPageNo()!=i){
							%>
							<a class="number" href="javascript:void(0);"><%=i%></a>
							<%
								}else{
							%>
							<a id="pagerColor" class="number" href="javascript:void(0);"><%=i%></a>
							<%
								}
							}
							%>
							<!-- 显示数字的结束 -->
							<a id="next" data-id="<%=pager.getPageNo() %>" href="javascript:void(0);">下一页</a>
							共<%=pager.getPageCount() %>页
						</div>
						<script src="<%=request.getContextPath()%>/manage/js/jquery.min.js"></script>
						<script>
							$(function(){
								$("#pagerColor").css("color","red");
								//下一页
									$("#next").click(function(){
								 	var n =<%=pager.getPageNo()%>
								 	if(n!=<%=pager.getPageCount()%>){
									 $.ajax({
										 url:"<%=request.getContextPath()%>/WorksReportManageServlet?action=getWorksReportsPager",
											type:"post",
											data:{pageNo:n+1},
											success:function(mes){
								
												$(".result-content").html(mes);
											}
										});//ajax的结束
								 	}
								});
									//上一页
									$("#prev").click(function(){
									 	var n =<%=pager.getPageNo()%>
									 	if(n!=1){
										 $.ajax({
											 url:"<%=request.getContextPath()%>/WorksReportManageServlet?action=getWorksReportsPager",
												type:"post",
												data:{pageNo:n-1},
												success:function(mes){
									
													$(".result-content").html(mes);
												}
											});//ajax的结束
									 	}
									});
							});
						</script>